#region Using directives
using System;
using System.IO;
using SharpWind.Helpers;
using Microsoft.DirectX;
#endregion

namespace SharpWind.Resources.Sound
{
	public class Listener
	{
		#region Methods
		
		public void SetEnvironment( string file )
		{
			FreeSL.FSL_EAX_LISTENER_PROPERTIES env = FreeSL.fslLoadListenerEnvironment( Path.Combine( Directories.Environments, file ) );
			FreeSL.fslSetListenerEnvironment( env );
		}

		public void SetEnvironment( string package, string file )
		{
			FreeSL.FSL_EAX_LISTENER_PROPERTIES env = FreeSL.fslLoadListenerEnvironmentFromZip( Path.Combine( Directories.Content, package ), file );
			FreeSL.fslSetListenerEnvironment( env );
		}

		public void SetEnvironment( Environment environment )
		{
			FreeSL.fslSetListenerEnvironmentPreset( environment );
		}

		public void SetOrientation( Vector3 at, Vector3 up )
		{
			FreeSL.fslSetListenerOrientation( at.X, at.Y, at.Z, up.X, up.Y, up.Z );
		}

		#endregion

		#region Properties

		public Vector3 Position
		{
			set
			{
				FreeSL.fslSetListenerPosition( value.X, value.Y, value.Z );
			}
		}

		public Vector3 Velocity
		{
			set
			{
				FreeSL.fslSetListenerVelocity( value.X, value.Y, value.Z );
			}
		}

		#endregion
	}
}
